﻿const http = require('http');

const server = http.createServer((req, res) => {
    let body = [];
    req.on('data', (chunk) => {
        body.push(chunk);
    });
    req.on('end', () => {
       body = Buffer.concat(body).toString();
       let userName = 'Unknown User';
       if(body){
           userName = body.split('=')[1];
       }
       res.setHeader('Content-type', 'text/html;');
       res.write(`<h1>${userName}</h1>`);
       res.write('<h1>hello there!</h1>');
       res.end();
    });


});

server.listen(3000);